package com.spark.service.producer;

import com.spark.common.ExchangeName;
import com.spark.common.RoutingKeyName;
import com.spark.entity.BusTypeMsgSendVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

/**
 * @Author sc
 * @DATE 2024/5/23 14:58
 * @Description:
 * @Version 1.0
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class BusTypeMsgProducer {

    private final RabbitTemplate rabbitTemplate;

    /**
     *  生产者发送消息
     * @param busTypeMsgSendVO
     */
    public void send(BusTypeMsgSendVO busTypeMsgSendVO) {
        log.info("=========================生产者发送消息=========================");
        log.info("生产者发送消息==========，{}",busTypeMsgSendVO);
        rabbitTemplate.convertAndSend(ExchangeName.NOTIFY_MSG.name(),
                RoutingKeyName.BUS_TYPE_MSG.name(), busTypeMsgSendVO);
    }

}
